#pragma once

#ifndef _ROBOT_H
#define _ROBOT_H

class Robot
{

private:

	int			id;
	float		maxLoad;
	float		currentLoad;
	int			position;

public:

	Robot(void);
	Robot(int id, float maxLoad, float currentLoad, int position);
	~Robot(void);

	int		getId(void) const;
	int		getPosition(void) const;
	float	getMaxLoad(void) const;
	float	getCurrentLoad(void) const;

	void	setPosition(int position);
	void	setCurrentLoad(float currentLoad);
	void	setId(int id);
	void	setMaxLoad(float maxLoad);

	///

	bool	operator == (const Robot& r) const;				// Compares id
	bool	operator == (int id) const;

	bool	operator >	(const Robot& r) const;				// Compares currentLoad
	bool	operator >	(float currentLoad) const;	// Compares currentLoad

	void	operator =	(const Robot& r);					// Assigns currentLoad and position;

	void	printRobot	(ostream& out) const;
	friend	ostream& operator << (ostream& out, const Robot& r);
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS & DESTRUCTOR

Robot :: Robot(void)
{
	this->id = -1;
	this->position= -1;
	this->maxLoad = -1;
	this->currentLoad = -1;
}

Robot :: Robot(int id, float maxLoad, float currentLoad, int position)
{
	this->id = id;
	this->maxLoad = maxLoad;
	this->currentLoad = currentLoad;
	this->position = position;
}

Robot :: ~Robot(void)
{
	//cout << "Robot " << this->getId() << " was deleted" << endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OTHER METHODS

void Robot :: printRobot(ostream& out) const
{
	out <<
		"Key: " << this->getId() << endl <<
		"Max capacity: " << this->getMaxLoad() << endl <<
		"Current load: " << this->getCurrentLoad() << endl <<
		"Current position: " << this->getPosition() << endl << endl;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OPERATORS

bool Robot :: operator == (const Robot& r) const
{
	return (
		this->getId() == r.getId()
		);
}

bool Robot :: operator == (int id) const
{
	return (
		this->getId() == id
		);
}

bool Robot :: operator > (const Robot& r) const
{
	return(
		this->getCurrentLoad() > r.getCurrentLoad()
		);
}

bool Robot :: operator > (float currentLoad) const
{
	return(
		this->getCurrentLoad() > currentLoad
		);
}

void Robot :: operator = (const Robot& r)
{
	this->setId(r.getId());
	this->setMaxLoad(r.getMaxLoad());
	this->setCurrentLoad(r.getCurrentLoad());
	this->setPosition(r.getPosition());
}

ostream& :: operator << (ostream& out, const Robot& r)
{
	r.printRobot(out);
	return out;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// GETS & SETS

int Robot :: getId(void) const
{
	return this->id;
}

int Robot :: getPosition(void) const
{
	return this->position;
}

float Robot :: getMaxLoad(void) const
{
	return this->maxLoad;
}

float Robot :: getCurrentLoad(void) const
{
	return this->currentLoad;
}

void Robot :: setPosition(int position)
{
	this->position = position;
}

void Robot :: setCurrentLoad(float currentLoad)
{
	this->currentLoad = currentLoad;
}

void Robot :: setId(int id)
{
	this->id = id;
}

void Robot :: setMaxLoad(float maxLoad)
{
	this->maxLoad = maxLoad;
}

#endif